@extends('front.common.header')
@section('title', $company->name.' - 企业招聘')

@section('header')
@parent
@stop

@section('content')
<link href="{{ asset('/css/company/jobs.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
<link href="{{ asset('/addons/zoom/css/zoom.css') }}" rel="stylesheet" type="text/css">
{{-- 主体内容 --}}
<div id="jobs-main-content">
    @if($company)
    {{-- 面包屑导航 --}}
    <div id="com-details-menu">
        <ul>
            <li class="first"><a href="/" target="_blank">首页</a></li>
            <li><span>|</span></li>
            @if(!empty($training))
            <li><a href="{{ url('/teaches') }} " target="_self">充电加油</a></li>
            <li><span>|</span></li>
            <li>
                <a href="{{url('/teaches/list/3')}}" target="_self">企业专区</a>
            </li>
            <li><span>|</span></li>
            <li class="last">
                <a href="{{url('/teaches/list/3')}}">{{str_limit($company->name,8)}}&nbsp;<i class="icon-remove c9"></i></a>
            </li>
            @else
            <li><a href="{{ url('/company') }} " target="_self">企业招聘</a></li>
            <li><span>|</span></li>
            <li><a href="{{ url('/company/list?typeid=2') }}" target="_self">热门企业</a></li>
            <li><span>|</span></li>
            <li class="last">
                <a href="{{ url('/company/list?typeid=2')}}">{{str_limit($company->name,8)}}&nbsp;<i class="icon-remove c9"></i></a>
            </li>
            @endif
        </ul>
    </div>
    <div id="com-details-wrap">
        {{-- 左侧内容 --}}
        <div id="com-details-wrap-left" class="fl mr10">
            {{-- 公司基础信息 --}}
            <div id="com-base">
               <div class="comlogo fl">
                   <a href="http://{{$company->main_page}}">
                      <img src="{{ $company->logo }}">
                   </a>
               </div>
                <div class="cominfo fl">
                   <h3 class="c3">{{$company->name}}</h3>
                   <p class="fs16 c6">{{str_limit($company->signature,52)}}<em>|</em><a href="{{$company->main_page}}">{{$company->name}}</a></p>
                    @foreach($tags as $tag)
                   <span>{{ $tag }}</span>
                    @endforeach
                </div>
                <div class="clr"></div>
            </div>

            {{-- 内训图展 --}}
            @if(!empty($trains)&&(count($trains)>0))
            <div id="com-trains-imgs">
                <h4 class="c0 pt15 pb15 pl20 ma0">
                    企业内训
                    <div class="fr">
                     <div class="fl pr10 cp" id="preComs">
                        <img src="{{ asset('/images/front/training/pre.png') }}" />
                        <span class="fs14 c6">上一组</span>
                     </div>
                     <div class="fr pr10 cp" id="nextComs">
                          <span class="fs14 c6">下一组</span>
                          <img src="{{ asset('/images/front/training/next.png') }}" />
                     </div>
                    </div>
                    <div class="clrar"></div>
                </h4>
                <div id="com-trains-main"  class="row show-middle-grid">
                    @foreach($trains as $key=>$train)
                    <div class="col-xs-3 col-sm-3 col-md-3 mt20 mb20">
                        <div class="com-trains-logo">
                           <a href="{{url('/teaches/company/show/'.$train->id)}}" target="_blank">
                             <img src="@if(count($train->attachment)>0){{$train->attachment->url}}@else{{asset('/images/front/jyz/4.png')}}@endif">
                           </a>
                        </div>
                        <p class="pt10 fs14 c2">{{str_limit($train->name,28)}}</p>
                        <p class="fs14 c4">
                            @if(($train->price)>=10000) 9999+积分
                            @elseif($train->price) {{$train->price}}积分
                            @elseif(!$train->price) 免费
                            @endif
                            |<span class="fs14 c7">&nbsp; {{str_limit($train->author,20)}}</span>
                        </p>
                    </div>
                    @endforeach
                </div>
                <input type="hidden" name="precompages" value="{{$precompages}}" />
                <input type="hidden" name="compages" value="{{$compages}}" />
                <script>
                    $(function(){
                         $("#nextComs").click(function(){
                             var p = $("input[name=compages]").val();
                             var type ='next';
                                  $.ajax({
                                        type:'post',
                                        cache:'false',
                                        url:'/teachescom/next',
                                        data:"page="+p+"&type="+type+"&cid="+'{{$company->id}}'+"&_token="+'{{ csrf_token() }}',
                                        dataType:'json',
                                        success:function(data){
                                            if(data.status == 'success'){
                                                var jsonData = data.data;
                                                var html = '';
                                                $.each(jsonData,function(index,item){
                                                    html +='<div class="col-xs-3 col-sm-3 col-md-3 mt20 mb20">';
                                                       html +='<div class="com-trains-logo">';
                                                          html +='<a href="/teaches/company/show/'+item.id+'" target="_blank">';
                                                             html +='<img src="'+item.logo+'"/>';
                                                          html +='</a>';
                                                       html +='</div>';
                                                       html +='<p class="pt10 fs14 c2">'+item.com_name+'</p>';
                                                       html +='<p class="fs14 c4">'+item.pricename+'|';
                                                          html +='<span class="fs14 c7">&nbsp;'+item.author_name+'</span>';
                                                       html +='</p>';
                                                    html +='</div>';
                                                    });
                                                    $('#com-trains-main').empty();
                                                    $('#com-trains-main').append(html);
                                                    $("input[name=compages]").val(data.pages);
                                                    $("input[name=precompages]").val(data.pages-2);
                                            }else{
                                                dialog();
//                                                $("#tipsmsg").show().html("没有更多数据了！").fadeOut(2000);
                                            }
                                        },
                                        error:function(){
                                                alert('error');
                                        }
                                  });
                         });
                         $("#preComs").click(function(){
                            var p = $("input[name=precompages]").val();
                             if(p >= 0){
                                 var type ='pre';
                                 $.ajax({
                                     type:'post',
                                     cache:'false',
                                     url:'/teachescom/next',
                                     data:"page="+p+"&type="+type+"&cid="+'{{$company->id}}'+"&_token="+'{{ csrf_token() }}',
                                     dataType:'json',
                                     success:function(data){
                                         if(data.status == 'success'){
                                             var jsonData = data.data;
                                             var html = '';
                                             $.each(jsonData,function(index,item){
                                                 html +='<div class="col-xs-3 col-sm-3 col-md-3 mt20 mb20">';
                                                 html +='<div class="com-trains-logo">';
                                                 html +='<a href="/teaches/company/show/'+item.id+'" target="_blank">';
                                                 html +='<img src="'+item.logo+'"/>';
                                                 html +='</a>';
                                                 html +='</div>';
                                                 html +='<p class="pt10 fs14 c2">'+item.com_name+'</p>';
                                                 html +='<p class="fs14 c4">'+item.pricename+'|';
                                                 html +='<span class="fs14 c7">&nbsp;'+item.author_name+'</span>';
                                                 html +='</p>';
                                                 html +='</div>';
                                             });
                                             $('#com-trains-main').empty();
                                             $('#com-trains-main').append(html);
                                             $("input[name=compages]").val(data.pages+2);
                                             $("input[name=precompages]").val(data.pages);
                                         }else{
                                             dialog();
//                                                $("#tipsmsg").show().html("没有更多数据了！").fadeOut(2000);
                                         }
                                     },
                                     error:function(){
                                         alert('error');
                                     }
                                 });
                             }else{
                                 dialog();
                             }

                        });
                    });
                    function dialog(){
                        layer.msg('没有更多数据！',{time:1000});
                    }
                </script>
            </div>

            @endif
            {{-- 公司简介 --}}
            <div id="com-intr">
                <h4 class="c0 pt15 pb15 pl20 ma0">公司简介</h4>
                <div id="com-intr-main">
                    {!! $company->intro !!}
                </div>
            </div>

            {{-- 企业风采 --}}
            @if( count($photos) > 0 )
            <div id="com-show-imgs">
                <h4 class="c0 pt15 pb15 pl20 ma0">企业风采</h4>
                <div id="show-imgs-main" class="row show-small-grid gallery">

                    @foreach($photos as $photo)
                    <div class="col-xs-3 col-sm-3 col-md-3 mt20 mb20">
                        <a href="{{ $photo->path }}"><img src="{{ $photo->path }}"></a>
                    </div>
                    @endforeach

                </div>
                <script type="text/javascript" src="{{ asset('/addons/zoom/js/zoom.min.js')}}"></script>
            </div>
            @endif

            {{-- 企业招聘 --}}
            <div id="com-jobs-list">
                <h4 class="c0 pt15 pb15 pl20 ma0">企业招聘</h4>
                @foreach($jobslist as $key => $job)
                <div id="jobs-list-main" class="row show-grid" @if($key == (count($jobslist)-1)) style="border:none;" @endif>
                      <div class="col-xs-10 col-sm-10 col-md-10">
                          <p class="ma lh38 fs16 c3">{{$job->areas->title}}&minus;{{$job->title}}&nbsp;({{$job->gzxz_name}})</p>
                          <p class="ma lh38 fs14 c3">月薪：<em class="cff">
                             @if(($job->salary_lower == 0 || empty($job->salary_lower)) && ($job->salary_high == 0 || empty($job->salary_high)))
                            面议
                            @elseif(($job->salary_lower == 0 || empty($job->salary_lower)) && $job->salary_high > 0)
                            {{$job->salary_high}}k以下
                            @else
                            {{ $job->salary_lower }}k-{{ $job->salary_high }}k
                            @endif
                          </em></p>
                      </div>
                      <div class="col-xs-2 col-sm-2 col-md-2">
                          <div class="jobs-details-link">
                              <a href="{{ url('/company/detail?typeid=1&jobsid='.$job->jobs_id) }}" target="_self">了解详情</a>
                          </div>
                      </div>
                </div>
                @endforeach
            </div>

        {{-- 企业评论 --}}
        <div id="com-comments-list">
            <h4 class="c0 pt15 pb15 pl20 ma0">全部评论</h4>
            <div id="itemContainer" >
                @foreach($comments as $k=>$vo)
                <div class="comment-common" id="comment-common{{$k}}">
                    <div class="comment-user-avatar fl pt10">
                        <img src="{{userlogo($vo->user_id,'middle')}}">
                    </div>
                    <div class="comment-main fl">
                        <div class="comment-content text-left">
                            <p class="font-20 c3">{{getUserName($vo->user_id)}}</p>
                            <p class="fs14 c5">{{$vo->content}}</p>
                            <div class="fs14 c9 ma0">
                                <div class="fl">
                                    {{$vo->created_at}}&nbsp;&nbsp;&nbsp;&nbsp;
                                    <a href="javascript:;" onclick="showreply({{$vo->comment_id}})">回复</a>
                                </div>
                                <div class="fr mr15">
                                    <img src="{{ asset('/images/front/jiuyezhinan/pl.png') }}">
                                    @if(count($vo->childComments)>0)
                                    <input type="text" name="totalnum{{$vo->comment_id}}" value="{{count($vo->childComments)}}" readonly="readonly">
                                    @else
                                    <input type="text" name="totalnum{{$vo->comment_id}}" value="0" readonly="readonly">
                                    @endif
                                </div>
                                <div class="clr"></div>
                            </div>
                        </div>
                        <div id="comment-reply{{$vo->comment_id}}" class="comment-reply-form mt20 dn">
                            <div class="comment-reply-form-b">
                                <textarea id="comment-reply-content{{$vo->comment_id}}" class="fl" placeholder="人可以走,留下你的态度"></textarea>
                                <button type="button" id="submit{{$vo->comment_id}}" class="fr" @if(empty($authuser))onclick="loginTips()" @else onclick="pushComment('/comment/push?typeid=1','{{$vo->comment_id}}','{{$vo->user_id}}','0','{{$company->id}}','{{ csrf_token() }}')" @endif>发表回复</button>
                            </div>
                        </div>
                        <div id="message{{$vo->comment_id}}" class="commentmsg dn"></div>
                        <div class="comment-child text-left" id="comment-childs{{$vo->comment_id}}">
                            @if(count($vo->childComments)>0)
                            <div class="comment-caret-up"><i class="glyphicon glyphicon-triangle-top"></i></div>
                            <div class="comment-child-content" id="comment-child-content{{$vo->comment_id}}">
                                @foreach($vo->childComments as $key=>$zn)
                                @if($key<3)
                                <div class="comment-child-content-list" >
                                    <p class="fs18 color-green">{{getUserName($zn->user_id)}}：</p>
                                    <p class="fs14 c5">{{$zn->content}}</p>
                                </div>
                                @endif
                                @endforeach
                            </div>
                            @endif
                        </div>
                    </div>
                    <div class="clr"></div>
                </div>
                @endforeach
            </div>
            {{-- 分页 --}}
            <div id="holder" @if(count($comments)== 0) class="holder dn" @else class="holder" @endif></div>
            <script>
                jPages();
            </script>
            <div class="comment-reply-main">
                <textarea id="comment-reply-content" placeholder="人可以走,留下你的态度"></textarea>
                <div class="mb20 lh44 mt10">
                    <div id="message" class="fl"></div>
                    <button type="button" class="fr" id="submit-main" @if(empty($authuser))onclick="loginTips()" @else onclick="comment('/comment/push?typeid=1','0','{{$company->id}}','1','{{ csrf_token() }}')" @endif>发表回复</button>
                </div>
            </div>
        </div>
    </div>
        {{-- 右侧内容 --}}
        <div id="com-details-wrap-right" class="fl">
            {{-- 企业信息 --}}
            <div id="com-info">
                <h4 class="c0 pt15 pb15 pl20 ma0">企业信息</h4>
                <div id="com-info-main">
                    <p class="fs16 c3 cp" title="{{$company->name}}">{{str_limit($company->name,24)}}</p>
                    <div class="fs14 c3" style="height: auto;margin: 0 0 10px;">
                        行业：
                        <span style="display: inline-block; float: right; width: 165px">
                        @foreach($types as $key=>$type)
                        <span class="c6" style="display: inline-block;height: 18px;line-height: 18px;">
                        {{$type}} @if(count($types)>($key+1)) 、@endif
                        </span>
                        @endforeach
                        </span>
                        <div class="clr"></div>
                    </div>
                    <p class="fs14 c3">规模：&nbsp;<em class="c6">{{$company->scale_name}}</em></p>
                    <p class="fs14 c3 cp" title="{{$company->area_name}}{{$company->address}}">地址：&nbsp;<em class="c6">{{$company->area_name}}{{str_limit($company->address, 14)}}</em></p>
                    {{--<p class="fs14 c3">电话：<em class="c6">{{$company->phone}}</em></p>--}}
                    <p class="fs14 c3">电话：&nbsp;<em class="c6">{{$company->tel}}</em></p>
                    <p class="fs14 c3">邮编：&nbsp;<em class="c6">{{empty($company->zip_code)?'':$company->zip_code}}</em></p>
                    <p class="fs14 c3 cp" title="{{$company->bus_route}}">路线：&nbsp;<em class="c6">{{str_limit($company->bus_route, 16)}}</em></p>
                    <div class="baidu-map">
                        <div id="allmap"></div>
                    </div>
                    <p class="fs14 c9 tac">
                        <a href="javascript:;" title="{{$company->name}}" onclick="showmap('/map?cid={{$company->id}}','{{$company->name}}');">查看完整地图</a>
                        <input type="hidden" name="longitude" id="longitude" value="{{$company->longitude}}">
                        <input type="hidden" name="latitude" id="latitude" value="{{$company->latitude}}">
                    </p>
                </div>
                <script type="text/javascript">
                    $(function(){
                        cmap('{{$company->area_name}}','{{$company->address}}');
                    });
                </script>
            </div>
           {{-- 热门企业推荐 --}}
            @if(!empty($likecoms))
             <div id="com-recommend">
                <h4 class="c0 pt15 pb15 pl20 ma0">热门企业</h4>
                <div id="com-recommend-main">
                 @foreach($likecoms as $key => $lcoms)
                    <div @if($key == (count($likecoms)-1)) class="com-recommend-list bbn" @else  class="com-recommend-list" @endif>
                       <div class="com-mall-logo fl">
                          <a href="{{ url('/company/detail?typeid=2&comid='.$lcoms->id) }}">
                            <img src="{{ $lcoms->logo }}">
                          </a>
                       </div>
                       <div class="com-mall-info fr">
                           <p class="fs16 c3">
                              <a href="{{ url('/company/detail?typeid=2&comid='.$lcoms->id) }}" title="{{$lcoms->name}}" style="text-decoration:none;">{{str_limit($lcoms->name,14)}}</a>
                           </p>
                           <p class="fs14 c0">[{{$lcoms->area_middle_name}}]</p>
                       </div>
                       <div class="clr"></div>
                    </div>
                 @endforeach
                </div>
            </div>
            @endif
            {{-- 企业内训 --}}
            @if(!empty($training)&&(count($training)>0))
            <div id="com-training" >
                <h4 class="c0 pt15 pb15 pl20 ma0">企业内训</h4>
                <div id="com-training-main">
                    <ul>
                        @foreach($training as $train)
                        <li class="fs14 c3">
                            <a href="{{url('/teaches/company/show/'.$train->id)}}">
                                {{str_limit($train->name,22)}}
                            </a>
                        </li>
                        @endforeach
                    </ul>
                </div>
            </div>
            @endif
        </div>
        <div class="clr"></div>
    </div>
    @endif
</div>
@stop

@section('footer')
@parent
@stop

